//
//  SISSHouseProgressUploadPictureBottomInfoShowViewController.m
//  SISSAPP
//
//  Created by 袁应荣 on 2018/12/26.
//  Copyright © 2018 优房网. All rights reserved.
//

#import "SISSHouseProgressUploadPictureBottomInfoShowViewController.h"
#import "SISSHouseProgressUploadPictureBottomInfoViewController.h"
#import "SISSHouseProgressViewController.h"
#import "SISSNetworkingManager+HouseProgress.h"

@interface SISSHouseProgressUploadPictureBottomInfoShowViewController ()

///
@property (strong, nonatomic) SISSOrganApprovalModel *organApprovalModel;

@end

@implementation SISSHouseProgressUploadPictureBottomInfoShowViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"担保公司批单";
    self.titleStr = @"担保函";
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"back"] style:UIBarButtonItemStylePlain target:self action:@selector(backItemAction)];
    [self requestData];
}

/**
 返回按钮点击事件
 */
- (void)backItemAction {
    for (UIViewController *controller in self.navigationController.viewControllers) {
        if ([controller isKindOfClass:[SISSHouseProgressViewController class]]) {
            [self.navigationController popToViewController:controller animated:YES];
        }
    }
}

- (void)requestData {
    [kNetworkManager requestOrganApprovalInfoWithAhbpId:self.ahbpId success:^(SISSOrganApprovalModel *organApprovalModel) {
        self.imagesUrlArr = organApprovalModel.image;
        self.infoStr = organApprovalModel.otherdesc;
        self.organApprovalModel = organApprovalModel;
        if (self.isHistory && !organApprovalModel) {
            self.titleStr = @"";
            self.infoStr = @"";
        }
    } failed:^(NSError *error) {
        NSLog(@"%@",error);
    }];
}

- (void)editButtonClickAction {
    
    SISSHouseProgressUploadPictureBottomInfoViewController *vc = [[SISSHouseProgressUploadPictureBottomInfoViewController alloc] init];
    vc.ahbpId = self.ahbpId;
    vc.organApprovalModel = self.organApprovalModel;
    [self.navigationController pushViewController:vc animated:YES];
}

@end
